package bon.idlesun.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ArrayHelper {

	private ArrayHelper() {
	}
	
	public static class B {
		public static Byte[] toObjectArray(byte... values) {
			Byte objArray[] = new Byte[values.length];
			for (int i = 0; i < values.length; i++) {
				objArray[i] = values[i];
			}
			return objArray;
		}

		public static List<Byte> asObjectList(byte... values) {
			return Arrays.asList(toObjectArray(values));
		}

		public static List<Byte> toObjectList(byte... values) {
			return new ArrayList<Byte>(Arrays.asList(toObjectArray(values)));
		}

		public static byte[] toArray(Byte... objects) {
			byte[] array = new byte[objects.length];
			for (int i = 0; i < objects.length; i++) {
				array[i] = objects[i];
			}
			return array;
		}

		public static byte[] toArray(List<Byte> objectList) {
			return toArray(objectList.toArray(new Byte[objectList.size()]));
		}
	};

	public static class I {

		public static Integer[] toObjectArray(int... values) {
			Integer objArray[] = new Integer[values.length];
			for (int i = 0; i < values.length; i++) {
				objArray[i] = values[i];
			}
			return objArray;
		}

		public static List<Integer> asObjectList(int... values) {
			return Arrays.asList(toObjectArray(values));
		}

		public static List<Integer> toObjectList(int... values) {
			return new ArrayList<Integer>(Arrays.asList(toObjectArray(values)));
		}

		public static int[] toArray(Integer... objects) {
			int[] array = new int[objects.length];
			for (int i = 0; i < objects.length; i++) {
				array[i] = objects[i];
			}
			return array;
		}

		public static int[] toArray(List<Integer> objectList) {
			return toArray(objectList.toArray(new Integer[objectList.size()]));
		}

	};

	public static class L {

		public static Long[] toObjectArray(long... values) {
			Long objArray[] = new Long[values.length];
			for (int i = 0; i < values.length; i++) {
				objArray[i] = values[i];
			}
			return objArray;
		}

		public static List<Long> asObjectList(long... values) {
			return Arrays.asList(toObjectArray(values));
		}

		public static List<Long> toObjectList(long... values) {
			return new ArrayList<Long>(Arrays.asList(toObjectArray(values)));
		}

		public static long[] toArray(Long... objects) {
			long[] array = new long[objects.length];
			for (int i = 0; i < objects.length; i++) {
				array[i] = objects[i];
			}
			return array;
		}

		public static long[] toArray(List<Long> objectList) {
			return toArray(objectList.toArray(new Long[objectList.size()]));
		}

	};
}
